﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Xml.Linq;
using Microsoft.SharePoint;
using System.Text.RegularExpressions;

namespace LizardSoft.Common.FlexibleStructureDeployment
{
    public static partial class StructureHelper
    {
        private static bool IsListFolderUrlCorrect(ListProcessingInfo listProcessingInfo)
        {
            // ListFolderUrl библиотек не должен содержать "Lists/", а для списков - должен
            bool isLibrary = false;
            if (listProcessingInfo.TemplateType == SPListTemplateType.DocumentLibrary) isLibrary = true;
            else if (listProcessingInfo.TemplateType == SPListTemplateType.XMLForm) isLibrary = true;
            else if (listProcessingInfo.TemplateType == SPListTemplateType.DataConnectionLibrary) isLibrary = true;
            else if (listProcessingInfo.TemplateType == SPListTemplateType.PictureLibrary) isLibrary = true;
            else if (listProcessingInfo.TemplateType == SPListTemplateType.WebPageLibrary) isLibrary = true;
            
            if (isLibrary && listProcessingInfo.ListFolderUrl.Contains("Lists/")) return false;
            else if (!isLibrary && !listProcessingInfo.ListFolderUrl.Contains("Lists/")) return false;
            
            return true;
        }
    }
}
